package com.itboye.pondteam.presenter;

import com.itboye.pondteam.bean.PersonDataBean;
import com.itboye.pondteam.interfaces.IUserInfoInterface;
import com.itboye.pondteam.responsitory.UserResponsitory;
import com.itboye.pondteam.volley.BasePresenter;
import com.itboye.pondteam.volley.ICompleteListener;
import com.itboye.pondteam.volley.ResultEntity;

import java.util.Observer;


/**
 * Created by admin on 2016/11/28.
 */

public class UserPresenter extends BasePresenter implements
        IUserInfoInterface<PersonDataBean> {
    // 用户登录
    public static final String login_success = UserPresenter.class.getName()
            + "_User_success";
    public static final String login_fail = UserPresenter.class.getName()
            + "_User_fail";

    //注册
    public static final String register_fail = UserPresenter.class.getName()
            + "_Register_fail";
    public static final String register_success = UserPresenter.class.getName()
            + "_Register_success";
    //发送验证码
    public static String send_code_fail = "_Send_code_fail";
    public static String send_code_success = "_Send_code_success";
    //验证验证码
    public static String yanzheng_code_fail = "_yanzheng_code_fail";
    public static String yanzheng_code_success = "_yanzheng_code_success";
    //修改密码（通过验证码）
    public static String update_pass_success = "_updata_pass_success";
    public static String update_pass_fail = "_updata_pass_fail";
    //修改个人信息
    public static String updata_xinxi_success = "_updata_xinxi_success";
    public static String updata_xinxi_fail = "_updata_xinxi_fail";
    //修改密码（通过旧密码）
    public static String modify_pass_success = "_modify_pass_success";
    public static String modify_pass_fail = "_modify_pass_fail";
    //查询收货地址
    public static String query_address_success = "_query_address_success";
    public static String query_address_fail = "_query_address_fail";
    //添加收货地址
    public static String add_address_success = "_add_address_success";
    public static String add_address_fail = "_add_address_fail";
    //删除收货地址
    public static String delete_address_success = "_delete_address_success";
    public static String delete_address_fail = "_delete_address_fail";
    //更新收货地址
    public static String update_address_success = "_update_address_success";
    public static String update_address_fail = "_update_address_fail";

    //司机认证
    public static String renzheng_success = "_renzheng_success";
    public static String renzheng_fail = "_renzheng_fail";


    //技工认证
    public static String jg_success = "_jg_success";
    public static String jg_fail = "_jg_fail";
    //地理位置更新
    public static String weizhiUpdate_success = "_weizhiUpdate_success";
    public static String weizhiUpdate_fail = "_weizhiUpdate_fail";


    //获取配置
    public static String config_success = "_config_success";
    public static String config_fail = "_config_fail";


    //批量添加购物车
    public static String addAll_success = "_addAll_success";
    public static String addAll_fail = "_addAll_fail";
    //获取默认收货地址
    public static String moren_address_success = "_moren_address_success";
    public static String moren_address_fail = "_moren_address_fail";

    //获取用户设备列表
    public static String getMyDeviceList_success = "_getMyDeviceList_success";
    public static String getMyDeviceList_fail = "_getMyDeviceList_fail";

    //设备设置
    public static String deviceSet_success = "_deviceSet_success";
    public static String deviceSet_fail = "_deviceSet_fail";

    //设备添加
    public static String adddevice_success = "_adddevice_success";
    public static String adddevice_fail = "_adddevice_fail";

    public static String deleteDevice_success = "_deleteDevice_success";
    public static String deleteDevice_fail = "_deleteDevice_fail";

    public static String update_devicename_success = "_update_devicename_success";
    public static String update_devicename_fail = "_update_devicename_fail";
    public static String getMostNewPondDevice_success = "_getMostNewPondDevice_success";
    public static String getMostNewPondDevice_fail = "_getMostNewPondDevice_fail";
    public static String beginUpdatePondTeam_success = "_beginUpdatePondTeam_success";
    public static String beginUpdatePondTeam_fail = "_beginUpdatePondTeam_fail";
    public static String sendEmailCodesuccess = "_sendEmailCodesuccess";
    public static String sendEmailCodefail = "_sendEmailCodefail";


    public static String feedbacksuccess = "_feedbacksuccess";
    public static String feedbackfail = "_feedbackfail";

    public static String authDevicePwdsuccess = "_authDevicePwdsuccess";
    public static String authDevicePwdfail = "_authDevicePwdfail";

    public UserPresenter(Observer observer) {
        super(observer);
    }

    @Override
    public void login(String username, String pwd) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(login_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(login_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.login(username, pwd);
    }


    @Override
    public void registerByEmail(String nickname, String contact, String address, String email, String password) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(register_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(register_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }

                });
        user.registerByEmail(nickname, contact, address, email, password);
    }

    @Override
    public void sendVerificationCode(String country, String mobile, String code_type) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(send_code_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(send_code_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.sendVerificationCode(country, mobile, code_type);
    }

    @Override
    public void YanZhengverificationCode(String country, String mobile, String code, String code_type) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(yanzheng_code_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(yanzheng_code_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.YanZhengverificationCode(country, mobile, code, code_type);
    }

    @Override
    public void updatePass(String country, String code, String mobile, String password) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(update_pass_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(update_pass_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.updatePass(country, code, mobile, password);
    }

    @Override
    public void upadtaInformation(String uid, String types, String content) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(updata_xinxi_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(updata_xinxi_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.upadtaInformation(uid, types, content);
    }

    @Override
    public void modifyPass(String uid, String password, String new_password) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(modify_pass_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(modify_pass_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.modifyPass(uid, password, new_password);
    }

    @Override
    public void addressAdd(String s_id, String uid, String contactname, String mobile, String postal_code, String province, String city, String area, String detailinfo, String defaults, String country, String country_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(add_address_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(add_address_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.addressAdd(s_id, uid, contactname, mobile, postal_code, province, city, area, detailinfo, defaults, country, country_id);
    }

    @Override
    public void updateAddress(String s_id, String id, String uid, String contactname, String mobile, String postal_code, String province, String city, String area, String detailinfo, String defaults, String country, String country_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(update_address_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(update_address_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.updateAddress(s_id, id, uid, contactname, mobile, postal_code, province, city, area, detailinfo, defaults, country, country_id);
    }

    @Override
    public void sijiRenZheng(String uid, String id_number, String realname, String id_certs) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(renzheng_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(renzheng_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.sijiRenZheng(uid, id_number, realname, id_certs);
    }

    @Override
    public void jigongRenZheng(String uid, String skills) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(jg_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(jg_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.jigongRenZheng(uid, skills);
    }

    @Override
    public void weiZhiUpdate(String id, String lat, String lng, String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(weizhiUpdate_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(weizhiUpdate_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.weiZhiUpdate(id, lat, lng, s_id);
    }

    @Override
    public void getConfigApp() {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(config_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(config_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.getConfigApp();
    }


    @Override
    public void updatePwdByPwd(String uid, String oldPass, String newPass) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(getdeviceinfosuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(getdeviceinfofail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.updatePwdByPwd(uid, oldPass, newPass);
    }

    public static String getdeviceinfosuccess = "getdeviceinfosuccess";
    public static String getdeviceinfofail = "getdeviceinfofail";

    @Override
    public void getDeviceDetailInfo(String did, String uid, String psw) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(getdeviceinfosuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(getdeviceinfofail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.getDeviceDetailInfo(did, uid, psw);
    }

    public static String bindDevicesuccess = "bindDeviceSuccess";
    public static String bindDevicefail = "bindDevicefail";

    @Override
    public void bindDevice(String did, String uid) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(bindDevicesuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(bindDevicefail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.bindDevice(did, uid);
    }

    @Override
    public void getMyDeviceList(String uid) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(getMyDeviceList_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(getMyDeviceList_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.getMyDeviceList(uid);
    }

    @Override
    public void deviceSet(String did, String clEn, int clWeek, String clTm, String clDur, String clState, String clCfg, String uvOn, String uvOff, String uvWH, String uvCfg, int out_state_a, int out_state_b) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(deviceSet_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(deviceSet_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.deviceSet(did, clEn, clWeek, clTm, clDur, clState, clCfg, uvOn, uvOff, uvWH, uvCfg, out_state_a, out_state_b);
    }

    @Override
    public void addDevice(String uid, String did, String device_nickname) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(adddevice_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(adddevice_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.addDevice(uid, did, device_nickname);
    }

    @Override
    public void deleteDevice(String id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(deleteDevice_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(deleteDevice_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.deleteDevice(id);
    }

    @Override
    public void updateDeviceName(String id, String nickName, String chazuoA, String chazuoB) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(update_devicename_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(update_devicename_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.updateDeviceName(id, nickName, chazuoA, chazuoB);
    }

    @Override
    public void getMostNewPondDevice(String did) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(getMostNewPondDevice_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(getMostNewPondDevice_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.getMostNewPondDevice(did);
    }

    @Override
    public void beginUpdatePondTeam(String did) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(beginUpdatePondTeam_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(beginUpdatePondTeam_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.beginUpdatePondTeam(did);
    }

    @Override
    public void getDeviceStatus(String did) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(getdeviceinfosuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(getdeviceinfofail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.getDeviceStatus(did);
    }

    @Override
    public void sendEmailCode(String customText, String s) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(sendEmailCodesuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(sendEmailCodefail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.sendEmailCode(customText, s);
    }

    @Override
    public void feedback(String deviceType, String name, String email, String tel, String uid, String text) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(feedbacksuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(feedbackfail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.feedback(deviceType, name, email, tel, uid, text);
    }

    @Override
    public void authDevicePwd(String did, String ctrl_pwd, String deviceType) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(authDevicePwdsuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(authDevicePwdfail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.authDevicePwd(did, ctrl_pwd, deviceType);
    }
}
